package Text14;

import java.util.*;


public class Main {
    //    第一行包含两个整数 n和 m，分别表示数的个数和操作次数。
//    第二行包含 n个整数，表示完整数列。
//    接下来 m行，每行包含三个整数 k,a,b（k=0，表示求子数列[a,b]的和；k=1，
//    表示第 a个数加 b）。数列从 1开始计数。
    static int N = 100010, n, m;
    static int[] arr = new int[N];
    static PII[] w = new PII[4 * N];

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        m = in.nextInt();
        for (int i = 1; i <= n; i++) {
            arr[i] = in.nextInt();
        }
        bulid(1, 1, n);
        while (m-- > 0) {
            int k = in.nextInt();
            int a = in.nextInt();
            int b = in.nextInt();
            if (k == 0) {
                System.out.println(quary(1, a, b));
            } else if (k == 1) {
                modify(1, a, b);
            }
        }
    }

    private static void modify(int u, int x, int v) {
        if (w[u].l == w[u].r) {
            w[u].sum += v;
        } else {
            int mid = w[u].l + w[u].r >> 1;
            if (mid >= x) {
                modify(u << 1, x, v);
            } else {
                modify(u << 1 | 1, x, v);
            }
            up(u);
        }

    }

    private static long quary(int u, int l, int r) {
        if (w[u].l >= l && w[u].r <= r) {
            return w[u].sum;
        }
        int mid = w[u].l + w[u].r >> 1;
        long res = 0;
        if (mid >= l) {
            res = quary(u << 1, l, r);
        }
        if (mid + 1 <= r) {
            res += quary(u << 1 | 1, l, r);
        }
        return res;
    }

    private static void bulid(int u, int l, int r) {
        if (l == r) {
            w[u] = new PII(l, r, arr[l]);
        } else {
            w[u] = new PII(l, r);
            int mid = l + r >> 1;
            bulid(u << 1, l, mid);
            bulid(u << 1 | 1, mid + 1, r);
            up(u);
        }
    }

    private static void up(int u) {
        w[u].sum = w[u << 1].sum + w[u << 1 | 1].sum;
    }

}

class PII {
    int l, r, sum;

    public PII(int l, int r, int sum) {
        this.l = l;
        this.r = r;
        this.sum = sum;
    }

    public PII(int l, int r) {
        this.l = l;
        this.r = r;
    }
}
